<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>RPC简介 | 课程简介</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../C08-RPC/gRPC.html" />
    
    
    <link rel="prev" href="../C08-RPC/index.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="8.1"
        data-chapter-title="RPC简介"
        data-filepath="C08-RPC/AboutRPC.md"
        data-basepath=".."
        data-revision="Mon May 27 2019 03:35:45 GMT+0800 (CST)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        课程简介
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="C01-Introduction/index.html">
            
                
                    <a href="../C01-Introduction/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        项目介绍
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="C01-Introduction/AboutToutiaoWebVM.html">
            
                
                    <a href="../C01-Introduction/AboutToutiaoWebVM.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        ToutiaoWeb虚拟机使用说明
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="C01-Introduction/PycharmRemoteDevelop.html">
            
                
                    <a href="../C01-Introduction/PycharmRemoteDevelop.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        Pycharm远程开发
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="C01-Introduction/AboutProject.html">
            
                
                    <a href="../C01-Introduction/AboutProject.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        产品与开发
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="C02-Database/index.html">
            
                
                    <a href="../C02-Database/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        数据库
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="C02-Database/DatabaseDesign.html">
            
                
                    <a href="../C02-Database/DatabaseDesign.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        数据库设计
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="C02-Database/ORM.html">
            
                
                    <a href="../C02-Database/ORM.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        理解ORM
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="C02-Database/SQLAlchemyMapping.html">
            
                
                    <a href="../C02-Database/SQLAlchemyMapping.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        SQLAlchemy映射构建
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="C02-Database/SQLAlchemyOperations.html">
            
                
                    <a href="../C02-Database/SQLAlchemyOperations.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        SQLAlchemy操作
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="C02-Database/DatabaseTheory.html">
            
                
                    <a href="../C02-Database/DatabaseTheory.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        数据库理论
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="C02-Database/DistributedID.html">
            
                
                    <a href="../C02-Database/DistributedID.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.6.</b>
                        
                        分布式ID
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="C02-Database/DatabaseOptimize.html">
            
                
                    <a href="../C02-Database/DatabaseOptimize.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.7.</b>
                        
                        数据库优化
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="C02-Database/Redis.html">
            
                
                    <a href="../C02-Database/Redis.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.8.</b>
                        
                        Redis
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="C03-Gitflow/index.html">
            
                
                    <a href="../C03-Gitflow/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        Git工作流
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="C03-Gitflow/Gitflow.html">
            
                
                    <a href="../C03-Gitflow/Gitflow.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        Gitflow
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="C03-Gitflow/AboutGit.html">
            
                
                    <a href="../C03-Gitflow/AboutGit.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        Git总结
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="C03-Gitflow/ProjectDirectory.html">
            
                
                    <a href="../C03-Gitflow/ProjectDirectory.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        工程目录
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="C03-Gitflow/DebugMethod.html">
            
                
                    <a href="../C03-Gitflow/DebugMethod.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.4.</b>
                        
                        调试方法
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="C04-JWT/index.html">
            
                
                    <a href="../C04-JWT/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        JWT
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="C04-JWT/JWT.html">
            
                
                    <a href="../C04-JWT/JWT.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        JWT &amp; JWS &amp; JWE
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="C04-JWT/PythonLib.html">
            
                
                    <a href="../C04-JWT/PythonLib.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        PythonLib
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="C04-JWT/Implement.html">
            
                
                    <a href="../C04-JWT/Implement.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.</b>
                        
                        实施方案
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="C04-JWT/Forbbiden.html">
            
                
                    <a href="../C04-JWT/Forbbiden.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.</b>
                        
                        禁用问题
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="C05-OSS/index.html">
            
                
                    <a href="../C05-OSS/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        对象存储
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1" data-path="C05-OSS/Qiniu.html">
            
                
                    <a href="../C05-OSS/Qiniu.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.</b>
                        
                        七牛云存储
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="C05-OSS/CDN.html">
            
                
                    <a href="../C05-OSS/CDN.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.</b>
                        
                        CDN
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6" data-path="C06-Cache/index.html">
            
                
                    <a href="../C06-Cache/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        缓存
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1" data-path="C06-Cache/CacheArchitecture.html">
            
                
                    <a href="../C06-Cache/CacheArchitecture.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.1.</b>
                        
                        缓存的架构
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="C06-Cache/CacheData.html">
            
                
                    <a href="../C06-Cache/CacheData.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.2.</b>
                        
                        缓存的数据
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="C06-Cache/CacheTTLAndEviction.html">
            
                
                    <a href="../C06-Cache/CacheTTLAndEviction.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.3.</b>
                        
                        缓存的有效期与淘汰策略
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.4" data-path="C06-Cache/CachePatterns.html">
            
                
                    <a href="../C06-Cache/CachePatterns.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.4.</b>
                        
                        缓存模式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.5" data-path="C06-Cache/CacheProblems.html">
            
                
                    <a href="../C06-Cache/CacheProblems.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.5.</b>
                        
                        缓存问题
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.6" data-path="C06-Cache/ProjectCacheAndStorageDesign.html">
            
                
                    <a href="../C06-Cache/ProjectCacheAndStorageDesign.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.6.</b>
                        
                        项目缓存与Redis持久存储设计
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.7" data-path="C06-Cache/ProjectCacheImplement.html">
            
                
                    <a href="../C06-Cache/ProjectCacheImplement.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.7.</b>
                        
                        项目缓存实现
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.8" data-path="C06-Cache/ProjectRedisStorageImplement.html">
            
                
                    <a href="../C06-Cache/ProjectRedisStorageImplement.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.8.</b>
                        
                        项目Redis持久存储实现
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="7" data-path="C07-APScheduler/index.html">
            
                
                    <a href="../C07-APScheduler/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.</b>
                        
                        APScheduler
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.1" data-path="C07-APScheduler/APSchedulerTutorial.html">
            
                
                    <a href="../C07-APScheduler/APSchedulerTutorial.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.1.</b>
                        
                        APScheduler使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.2" data-path="C07-APScheduler/FixStatistics.html">
            
                
                    <a href="../C07-APScheduler/FixStatistics.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.2.</b>
                        
                        定时修正统计数据
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="8" data-path="C08-RPC/index.html">
            
                
                    <a href="../C08-RPC/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.</b>
                        
                        RPC
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="8.1" data-path="C08-RPC/AboutRPC.html">
            
                
                    <a href="../C08-RPC/AboutRPC.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.1.</b>
                        
                        RPC简介
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.2" data-path="C08-RPC/gRPC.html">
            
                
                    <a href="../C08-RPC/gRPC.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.2.</b>
                        
                        gRPC
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.3" data-path="C08-RPC/ProtocolBuffers.html">
            
                
                    <a href="../C08-RPC/ProtocolBuffers.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.3.</b>
                        
                        Protocol Buffers
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.4" data-path="C08-RPC/RecoSysIDL.html">
            
                
                    <a href="../C08-RPC/RecoSysIDL.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.4.</b>
                        
                        推荐系统接口定义
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.5" data-path="C08-RPC/Server.html">
            
                
                    <a href="../C08-RPC/Server.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.5.</b>
                        
                        服务端
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.6" data-path="C08-RPC/Client.html">
            
                
                    <a href="../C08-RPC/Client.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.6.</b>
                        
                        客户端
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.7" data-path="C08-RPC/ToutiaoAPIViewImplement.html">
            
                
                    <a href="../C08-RPC/ToutiaoAPIViewImplement.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.7.</b>
                        
                        头条首页新闻推荐接口编写
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="9" data-path="C09-IM/index.html">
            
                
                    <a href="../C09-IM/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.</b>
                        
                        即时通信
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="9.1" data-path="C09-IM/AboutIM.html">
            
                
                    <a href="../C09-IM/AboutIM.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.1.</b>
                        
                        即时通信简介
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="9.2" data-path="C09-IM/WebSocket.html">
            
                
                    <a href="../C09-IM/WebSocket.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.2.</b>
                        
                        WebSocket
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="9.3" data-path="C09-IM/SocketIO.html">
            
                
                    <a href="../C09-IM/SocketIO.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.3.</b>
                        
                        Socket.IO
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="9.4" data-path="C09-IM/Chat.html">
            
                
                    <a href="../C09-IM/Chat.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.4.</b>
                        
                        头条聊天服务实现
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="9.5" data-path="C09-IM/MessagePush.html">
            
                
                    <a href="../C09-IM/MessagePush.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.5.</b>
                        
                        头条在线消息推送实现
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="10" data-path="C10-Elasticsearch/index.html">
            
                
                    <a href="../C10-Elasticsearch/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.</b>
                        
                        Elasticsearch
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="10.1" data-path="C10-Elasticsearch/Introduction.html">
            
                
                    <a href="../C10-Elasticsearch/Introduction.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.1.</b>
                        
                        简介与原理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10.2" data-path="C10-Elasticsearch/ConceptAndCluster.html">
            
                
                    <a href="../C10-Elasticsearch/ConceptAndCluster.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.2.</b>
                        
                        概念与集群
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10.3" data-path="C10-Elasticsearch/AnalysisIK.html">
            
                
                    <a href="../C10-Elasticsearch/AnalysisIK.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.3.</b>
                        
                        IK中文分析器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10.4" data-path="C10-Elasticsearch/IndexAndType.html">
            
                
                    <a href="../C10-Elasticsearch/IndexAndType.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.4.</b>
                        
                        索引与类型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10.5" data-path="C10-Elasticsearch/Document.html">
            
                
                    <a href="../C10-Elasticsearch/Document.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.5.</b>
                        
                        文档
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10.6" data-path="C10-Elasticsearch/Logstash.html">
            
                
                    <a href="../C10-Elasticsearch/Logstash.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.6.</b>
                        
                        Logstash导入数据
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10.7" data-path="C10-Elasticsearch/Query.html">
            
                
                    <a href="../C10-Elasticsearch/Query.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.7.</b>
                        
                        查询
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10.8" data-path="C10-Elasticsearch/ToutiaoSearchImplement.html">
            
                
                    <a href="../C10-Elasticsearch/ToutiaoSearchImplement.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.8.</b>
                        
                        头条全文检索实现
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10.9" data-path="C10-Elasticsearch/Suggest.html">
            
                
                    <a href="../C10-Elasticsearch/Suggest.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.9.</b>
                        
                        suggest查询
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10.10" data-path="C10-Elasticsearch/ToutiaoSuggestImplement.html">
            
                
                    <a href="../C10-Elasticsearch/ToutiaoSuggestImplement.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.10.</b>
                        
                        头条suggest查询实现
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="11" data-path="C11-Unittest.html">
            
                
                    <a href="../C11-Unittest.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.</b>
                        
                        单元测试
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="12" data-path="C12-Deployment/index.html">
            
                
                    <a href="../C12-Deployment/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>12.</b>
                        
                        部署相关
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="12.1" data-path="C12-Deployment/Gunicorn.html">
            
                
                    <a href="../C12-Deployment/Gunicorn.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>12.1.</b>
                        
                        Gunicorn
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="12.2" data-path="C12-Deployment/Supervisor.html">
            
                
                    <a href="../C12-Deployment/Supervisor.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>12.2.</b>
                        
                        Supervisor
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../" >课程简介</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="rpc&#x7B80;&#x4ECB;">RPC&#x7B80;&#x4ECB;</h1>
<h2 id="1-&#x4EC0;&#x4E48;&#x662F;rpc">1. &#x4EC0;&#x4E48;&#x662F;RPC</h2>
<p><strong>&#x8FDC;&#x7A0B;&#x8FC7;&#x7A0B;&#x8C03;&#x7528;</strong>&#xFF08;&#x82F1;&#x8BED;&#xFF1A;<strong>Remote Procedure Call</strong>&#xFF0C;&#x7F29;&#x5199;&#x4E3A; <strong>RPC</strong>&#xFF0C;&#x4E5F;&#x53EB;<strong>&#x8FDC;&#x7A0B;&#x7A0B;&#x5E8F;&#x8C03;&#x7528;</strong>&#xFF09;&#x662F;&#x4E00;&#x4E2A;&#x8BA1;&#x7B97;&#x673A;&#x901A;&#x4FE1;&#x534F;&#x8BAE;&#x3002;&#x8BE5;&#x534F;&#x8BAE;&#x5141;&#x8BB8;&#x8FD0;&#x884C;&#x4E8E;&#x4E00;&#x53F0;&#x8BA1;&#x7B97;&#x673A;&#x7684;&#x7A0B;&#x5E8F;&#x8C03;&#x7528;&#x53E6;&#x4E00;&#x53F0;&#x8BA1;&#x7B97;&#x673A;&#x7684;&#x5B50;&#x7A0B;&#x5E8F;&#xFF0C;&#x800C;&#x7A0B;&#x5E8F;&#x5458;&#x65E0;&#x9700;&#x989D;&#x5916;&#x5730;&#x4E3A;&#x8FD9;&#x4E2A;&#x4EA4;&#x4E92;&#x4F5C;&#x7528;&#x7F16;&#x7A0B;&#x3002;&#x5982;&#x679C;&#x6D89;&#x53CA;&#x7684;&#x8F6F;&#x4EF6;&#x91C7;&#x7528;&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x7F16;&#x7A0B;&#xFF0C;&#x90A3;&#x4E48;&#x8FDC;&#x7A0B;&#x8FC7;&#x7A0B;&#x8C03;&#x7528;&#x4EA6;&#x53EF;&#x79F0;&#x4F5C;<strong>&#x8FDC;&#x7A0B;&#x8C03;&#x7528;</strong>&#x6216;<strong>&#x8FDC;&#x7A0B;&#x65B9;&#x6CD5;&#x8C03;&#x7528;</strong>&#x3002;</p>
<p><img src="../images/RPC&#x793A;&#x610F;&#x56FE;.png" alt="RPC&#x793A;&#x610F;&#x56FE;"></p>
<h2 id="2-&#x80CC;&#x666F;&#x4E0E;&#x7528;&#x9014;">2. &#x80CC;&#x666F;&#x4E0E;&#x7528;&#x9014;</h2>
<p>&#x5728;&#x5355;&#x53F0;&#x8BA1;&#x7B97;&#x673A;&#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x7A0B;&#x5E8F;&#x8C03;&#x7528;&#x6765;&#x4F20;&#x9012;&#x63A7;&#x5236;&#x548C;&#x6570;&#x636E;&#xFF1B;&#x6216;&#x8005;&#x8BF4;&#x901A;&#x8FC7;&#x7A0B;&#x5E8F;&#x8C03;&#x7528;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x5C06;&#x591A;&#x4E2A;&#x7A0B;&#x5E8F;&#x7EC4;&#x6210;&#x4E00;&#x4E2A;&#x6574;&#x4F53;&#x6765;&#x5B9E;&#x73B0;&#x67D0;&#x4E2A;&#x529F;&#x80FD;&#x3002;</p>
<p>&#x5982;&#x679C;&#x5C06;&#x8FD9;&#x79CD;&#x8C03;&#x7528;&#x673A;&#x5236;&#x63A8;&#x5E7F;&#x5230;&#x591A;&#x53F0;&#x5F7C;&#x6B64;&#x95F4;&#x53EF;&#x4EE5;&#x8FDB;&#x884C;&#x7F51;&#x7EDC;&#x901A;&#x8BAF;&#x7684;&#x8BA1;&#x7B97;&#x673A;&#xFF0C;&#x7531;&#x591A;&#x53F0;&#x8BA1;&#x7B97;&#x673A;&#x4E2D;&#x7684;&#x591A;&#x4E2A;&#x7A0B;&#x5E8F;&#x7EC4;&#x6210;&#x4E00;&#x4E2A;&#x6574;&#x4F53;&#x6765;&#x5B9E;&#x73B0;&#x67D0;&#x4E2A;&#x529F;&#x80FD;&#xFF0C;&#x8FD9;&#x4E5F;&#x662F;&#x53EF;&#x4EE5;&#x7684;&#x3002;&#x8C03;&#x7528;&#x7684;&#x4E00;&#x65B9;&#xFF08;&#x53D1;&#x8D77;&#x8FDC;&#x7A0B;&#x8FC7;&#x7A0B;&#x8C03;&#x7528;&#xFF0C;&#x7136;&#x540E;&#x8C03;&#x7528;&#x8FD9;&#x65B9;&#x7684;&#x73AF;&#x5883;&#x6302;&#x8D77;&#xFF0C;&#x53C2;&#x6570;&#x901A;&#x8FC7;&#x7F51;&#x7EDC;&#x4F20;&#x9012;&#x7ED9;&#x88AB;&#x8C03;&#x7528;&#x65B9;&#xFF0C;&#x88AB;&#x8C03;&#x7528;&#x7684;&#x4E00;&#x65B9;&#x6267;&#x884C;&#x7A0B;&#x5E8F;&#xFF0C;&#x5F53;&#x7A0B;&#x5E8F;&#x6267;&#x884C;&#x5B8C;&#x6210;&#x540E;&#xFF0C;&#x4EA7;&#x751F;&#x7684;&#x7ED3;&#x679C;&#x518D;&#x901A;&#x8FC7;&#x7F51;&#x7EDC;&#x56DE;&#x4F20;&#x7ED9;&#x8C03;&#x7528;&#x7684;&#x4E00;&#x65B9;&#xFF0C;&#x8C03;&#x7528;&#x7684;&#x4E00;&#x65B9;&#x6062;&#x590D;&#x7EE7;&#x7EED;&#x6267;&#x884C;&#x3002;&#x8FD9;&#x6837;&#x4E00;&#x79CD;&#x539F;&#x578B;&#x601D;&#x60F3;&#xFF0C;&#x5C31;&#x662F;&#x6211;&#x4EEC;&#x6240;&#x8BF4;&#x7684;RPC&#x8FDC;&#x7A0B;&#x8FC7;&#x7A0B;&#x8C03;&#x7528;&#x3002;</p>
<p><img src="../images/&#x5355;&#x673A;&#x5230;&#x591A;&#x673A;.png" alt="&#x5355;&#x673A;&#x5230;&#x591A;&#x673A;"></p>
<p>RPC&#x8FD9;&#x79CD;&#x601D;&#x60F3;&#x6700;&#x65E9;&#x53EF;&#x4EE5;&#x8FFD;&#x6EAF;&#x5230;1976&#x5E74;&#xFF0C;RPC&#x7684;&#x53D1;&#x5C55;&#x5230;&#x4ECA;&#x5929;&#x5DF2;&#x7ECF;40&#x5E74;&#x6709;&#x4F59;&#x4E86;&#x3002;</p>
<p>&#x5982;&#x4ECA;&#x7684;&#x8BA1;&#x7B97;&#x673A;&#x5E94;&#x7528;&#x4E2D;&#xFF0C;&#x5355;&#x673A;&#x6027;&#x80FD;&#x4E0A;&#x5F88;&#x96BE;&#x627F;&#x53D7;&#x4F4F;&#x4EA7;&#x54C1;&#x7684;&#x538B;&#x529B;&#xFF0C;&#x9700;&#x8981;&#x4E0D;&#x65AD;&#x6269;&#x5145;&#x591A;&#x53F0;&#x673A;&#x5668;&#x6765;&#x63D0;&#x5347;&#x6574;&#x4F53;&#x7684;&#x6027;&#x80FD;&#x3002;&#x540C;&#x65F6;&#x4E3A;&#x4E86;&#x5145;&#x5206;&#x5229;&#x7528;&#x8FD9;&#x4E9B;&#x96C6;&#x7FA4;&#x91CC;&#x7684;&#x8BA1;&#x7B97;&#x673A;&#xFF0C;&#x9700;&#x8981;&#x5BF9;&#x5176;&#x4ECE;&#x67B6;&#x6784;&#x4E0A;&#x8FDB;&#x884C;&#x5212;&#x5206;&#xFF0C;&#x4EE5;&#x63D0;&#x4F9B;&#x4E0D;&#x540C;&#x7684;&#x670D;&#x52A1;&#xFF0C;&#x670D;&#x52A1;&#x95F4;&#x76F8;&#x4E92;&#x8C03;&#x7528;&#x5B8C;&#x6210;&#x6574;&#x4E2A;&#x4EA7;&#x54C1;&#x7684;&#x529F;&#x80FD;&#x3002;RPC&#x5C31;&#x80FD;&#x5E2E;&#x52A9;&#x6211;&#x4EEC;&#x89E3;&#x51B3;&#x8FD9;&#x4E9B;&#x670D;&#x52A1;&#x95F4;&#x7684;&#x4FE1;&#x606F;&#x4F20;&#x9012;&#x548C;&#x8C03;&#x7528;&#x3002;</p>
<h2 id="3-&#x6982;&#x5FF5;&#x8BF4;&#x660E;">3. &#x6982;&#x5FF5;&#x8BF4;&#x660E;</h2>
<p>&#x5173;&#x4E8E;RPC&#x7684;&#x6982;&#x5FF5;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x4ECE;&#x5E7F;&#x4E49;&#x548C;&#x72ED;&#x4E49;&#x6765;&#x5206;&#x522B;&#x8FDB;&#x884C;&#x7406;&#x89E3;&#x3002;</p>
<h4 id="&#x5E7F;&#x4E49;">&#x5E7F;&#x4E49;</h4>
<p>&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x5C06;&#x6240;&#x6709;&#x901A;&#x8FC7;&#x7F51;&#x7EDC;&#x6765;&#x8FDB;&#x884C;&#x901A;&#x8BAF;&#x8C03;&#x7528;&#x7684;&#x5B9E;&#x73B0;&#x7EDF;&#x79F0;&#x4E3A;RPC&#x3002;</p>
<p>&#x6309;&#x7167;&#x8FD9;&#x6837;&#x6765;&#x7406;&#x89E3;&#x7684;&#x8BDD;&#xFF0C;&#x90A3;&#x6211;&#x4EEC;&#x53D1;&#x73B0;HTTP&#x5176;&#x5B9E;&#x4E5F;&#x7B97;&#x662F;&#x4E00;&#x79CD;RPC&#x5B9E;&#x73B0;&#x3002;</p>
<p><img src="../images/HTTP.png" alt="HTTP"></p>
<h4 id="&#x72ED;&#x4E49;">&#x72ED;&#x4E49;</h4>
<p>&#x533A;&#x522B;&#x4E8E;HTTP&#x7684;&#x5B9E;&#x73B0;&#x65B9;&#x5F0F;&#xFF0C;&#x5728;&#x4F20;&#x8F93;&#x7684;&#x6570;&#x636E;&#x683C;&#x5F0F;&#x4E0A;&#x548C;&#x4F20;&#x8F93;&#x7684;&#x63A7;&#x5236;&#x4E0A;&#x72EC;&#x7ACB;&#x5B9E;&#x73B0;&#x3002;&#x6BD4;&#x5982;&#x5728;&#x673A;&#x5668;&#x95F4;&#x901A;&#x8BAF;&#x4F20;&#x8F93;&#x7684;&#x6570;&#x636E;&#x4E0D;&#x91C7;&#x7528;HTTP&#x534F;&#x8BAE;&#x7684;&#x65B9;&#x5F0F;&#xFF08;&#x5206;&#x4E3A;&#x8D77;&#x59CB;&#x884C;&#x3001;header&#x3001;body&#x4E09;&#x90E8;&#x4EFD;&#xFF09;&#xFF0C;&#x800C;&#x662F;&#x4F7F;&#x7528;&#x81EA;&#x5B9A;&#x4E49;&#x683C;&#x5F0F;&#x7684;&#x4E8C;&#x8FDB;&#x5236;&#x65B9;&#x5F0F;&#x3002;</p>
<p>&#x6211;&#x4EEC;&#x66F4;&#x591A;&#x65F6;&#x5019;&#x8C08;&#x5230;&#x7684;RPC&#x90FD;&#x662F;&#x6307;&#x4EE3;&#x8FD9;&#x79CD;&#x72ED;&#x4E49;&#x4E0A;&#x7684;&#x7406;&#x89E3;&#x3002;</p>
<h2 id="4-&#x4F18;&#x7F3A;&#x70B9;">4. &#x4F18;&#x7F3A;&#x70B9;</h2>
<p>&#x76F8;&#x6BD4;&#x4E8E;&#x4F20;&#x7EDF;HTTP&#x7684;&#x5B9E;&#x73B0;&#x800C;&#x8A00;&#xFF1A;</p>
<h4 id="&#x4F18;&#x70B9;">&#x4F18;&#x70B9;</h4>
<ul>
<li>&#x6548;&#x7387;&#x9AD8;</li>
<li>&#x53D1;&#x8D77;RPC&#x8C03;&#x7528;&#x7684;&#x4E00;&#x65B9;&#xFF0C;&#x5728;&#x7F16;&#x5199;&#x4EE3;&#x7801;&#x65F6;&#x53EF;&#x5FFD;&#x7565;RPC&#x7684;&#x5177;&#x4F53;&#x5B9E;&#x73B0;&#xFF0C;&#x5982;&#x540C;&#x7F16;&#x5199;&#x672C;&#x5730;&#x51FD;&#x6570;&#x8C03;&#x7528;&#x4E00;&#x6837;</li>
</ul>
<h4 id="&#x7F3A;&#x70B9;">&#x7F3A;&#x70B9;</h4>
<ul>
<li>&#x901A;&#x7528;&#x6027;&#x4E0D;&#x5982;HTTP&#x597D; 
  &#x56E0;&#x4E3A;&#x4F20;&#x8F93;&#x7684;&#x6570;&#x636E;&#x4E0D;&#x662F;HTTP&#x534F;&#x8BAE;&#x683C;&#x5F0F;&#xFF0C;&#x6240;&#x4EE5;&#x8C03;&#x7528;&#x53CC;&#x65B9;&#x9700;&#x8981;&#x4E13;&#x95E8;&#x5B9E;&#x73B0;&#x7684;&#x901A;&#x4FE1;&#x5E93;&#xFF0C;&#x5BF9;&#x4E8E;&#x4E0D;&#x540C;&#x7684;&#x7F16;&#x7A0B;&#x5F00;&#x53D1;&#x8BED;&#x8A00;&#xFF0C;&#x90FD;&#x8981;&#x6709;&#x76F8;&#x5173;&#x5B9E;&#x73B0;&#x3002;&#x800C;HTTP&#x4F5C;&#x4E3A;&#x4E00;&#x4E2A;&#x6807;&#x51C6;&#x534F;&#x8BAE;&#xFF0C;&#x5927;&#x90E8;&#x5206;&#x7684;&#x8BED;&#x8A00;&#x90FD;&#x5DF2;&#x6709;&#x76F8;&#x5173;&#x7684;&#x5B9E;&#x73B0;&#xFF0C;&#x901A;&#x7528;&#x6027;&#x66F4;&#x597D;&#x3002;</li>
</ul>
<p>HTTP&#x66F4;&#x591A;&#x7684;&#x9762;&#x5411;&#x7528;&#x6237;&#x4E0E;&#x4EA7;&#x54C1;&#x670D;&#x52A1;&#x5668;&#x7684;&#x901A;&#x8BAF;&#x3002;</p>
<p>RPC&#x66F4;&#x591A;&#x7684;&#x9762;&#x5411;&#x4EA7;&#x54C1;&#x5185;&#x90E8;&#x670D;&#x52A1;&#x5668;&#x95F4;&#x7684;&#x901A;&#x8BAF;&#x3002; thrift</p>
<h1 id="rpc&#x7ED3;&#x6784;">RPC&#x7ED3;&#x6784;</h1>
<p>RPC&#x7684;&#x8BBE;&#x8BA1;&#x601D;&#x60F3;&#x662F;&#x529B;&#x56FE;<strong>&#x4F7F;&#x8FDC;&#x7A0B;&#x8C03;&#x7528;&#x4E2D;&#x7684;&#x901A;&#x8BAF;&#x7EC6;&#x8282;&#x5BF9;&#x4E8E;&#x4F7F;&#x7528;&#x8005;&#x900F;&#x660E;</strong>&#xFF0C;&#x8C03;&#x7528;&#x53CC;&#x65B9;&#x65E0;&#x9700;&#x5173;&#x5FC3;&#x7F51;&#x7EDC;&#x901A;&#x8BAF;&#x7684;&#x5177;&#x4F53;&#x5B9E;&#x73B0;&#x3002;&#x56E0;&#x800C;&#x5B9E;&#x73B0;RPC&#x8981;&#x8FDB;&#x884C;&#x4E00;&#x5B9A;&#x7684;&#x5C01;&#x88C5;&#x3002;</p>
<p>RPC&#x539F;&#x7406;&#x4E0A;&#x662F;&#x6309;&#x5982;&#x4E0B;&#x7ED3;&#x6784;&#x6D41;&#x7A0B;&#x8FDB;&#x884C;&#x5B9E;&#x73B0;&#x7684;&#x3002;</p>
<p><img src="../images/RPC&#x7ED3;&#x6784;.png" alt="RPC&#x7ED3;&#x6784;"></p>
<h4 id="&#x6D41;&#x7A0B;&#xFF1A;">&#x6D41;&#x7A0B;&#xFF1A;</h4>
<ol>
<li>&#x8C03;&#x7528;&#x8005;&#xFF08;Caller, &#x4E5F;&#x53EB;&#x5BA2;&#x6237;&#x7AEF;&#x3001;Client&#xFF09;&#x4EE5;&#x672C;&#x5730;&#x8C03;&#x7528;&#x7684;&#x65B9;&#x5F0F;&#x53D1;&#x8D77;&#x8C03;&#x7528;&#xFF1B;</li>
<li>Client stub&#xFF08;&#x5BA2;&#x6237;&#x7AEF;&#x5B58;&#x6839;&#xFF0C;&#x53EF;&#x7406;&#x89E3;&#x4E3A;&#x8F85;&#x52A9;&#x52A9;&#x624B;&#xFF09;&#x6536;&#x5230;&#x8C03;&#x7528;&#x540E;&#xFF0C;&#x8D1F;&#x8D23;&#x5C06;&#x88AB;&#x8C03;&#x7528;&#x7684;&#x65B9;&#x6CD5;&#x540D;&#x3001;&#x53C2;&#x6570;&#x7B49;&#x6253;&#x5305;&#x7F16;&#x7801;&#x6210;&#x7279;&#x5B9A;&#x683C;&#x5F0F;&#x7684;&#x80FD;&#x8FDB;&#x884C;&#x7F51;&#x7EDC;&#x4F20;&#x8F93;&#x7684;&#x6D88;&#x606F;&#x4F53;&#xFF1B;</li>
<li>Client stub&#x5C06;&#x6D88;&#x606F;&#x4F53;&#x901A;&#x8FC7;&#x7F51;&#x7EDC;&#x53D1;&#x9001;&#x7ED9;&#x5BF9;&#x7AEF;&#xFF08;&#x670D;&#x52A1;&#x7AEF;&#xFF09;</li>
<li>Server stub&#xFF08;&#x670D;&#x52A1;&#x7AEF;&#x5B58;&#x6839;&#xFF0C;&#x540C;&#x6837;&#x53EF;&#x7406;&#x89E3;&#x4E3A;&#x8F85;&#x52A9;&#x52A9;&#x624B;&#xFF09;&#x6536;&#x5230;&#x901A;&#x8FC7;&#x7F51;&#x7EDC;&#x63A5;&#x6536;&#x5230;&#x6D88;&#x606F;&#x540E;&#x6309;&#x7167;&#x76F8;&#x5E94;&#x683C;&#x5F0F;&#x8FDB;&#x884C;&#x62C6;&#x5305;&#x89E3;&#x7801;&#xFF0C;&#x83B7;&#x53D6;&#x65B9;&#x6CD5;&#x540D;&#x548C;&#x53C2;&#x6570;&#xFF1B;</li>
<li>Server stub&#x6839;&#x636E;&#x65B9;&#x6CD5;&#x540D;&#x548C;&#x53C2;&#x6570;&#x8FDB;&#x884C;&#x672C;&#x5730;&#x8C03;&#x7528;&#xFF1B;</li>
<li>&#x88AB;&#x8C03;&#x7528;&#x8005;&#xFF08;Callee&#xFF0C;&#x4E5F;&#x53EB;Server&#xFF09;&#x672C;&#x5730;&#x8C03;&#x7528;&#x6267;&#x884C;&#x540E;&#x5C06;&#x7ED3;&#x679C;&#x8FD4;&#x56DE;&#x7ED9;server stub;</li>
<li>Server stub&#x5C06;&#x8FD4;&#x56DE;&#x503C;&#x6253;&#x5305;&#x7F16;&#x7801;&#x6210;&#x6D88;&#x606F;&#xFF0C;&#x5E76;&#x901A;&#x8FC7;&#x7F51;&#x7EDC;&#x53D1;&#x9001;&#x7ED9;&#x5BF9;&#x7AEF;&#xFF08;&#x5BA2;&#x6237;&#x7AEF;&#xFF09;&#xFF1B;</li>
<li>Client stub&#x6536;&#x5230;&#x6D88;&#x606F;&#x540E;&#xFF0C;&#x8FDB;&#x884C;&#x62C6;&#x5305;&#x89E3;&#x7801;&#xFF0C;&#x8FD4;&#x56DE;&#x7ED9;Client&#xFF1B;</li>
<li>Client&#x5F97;&#x5230;&#x672C;&#x6B21;RPC&#x8C03;&#x7528;&#x7684;&#x6700;&#x7EC8;&#x7ED3;&#x679C;&#x3002;</li>
</ol>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../C08-RPC/index.html" class="navigation navigation-prev " aria-label="Previous page: RPC"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../C08-RPC/gRPC.html" class="navigation navigation-next " aria-label="Next page: gRPC"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../gitbook/app.js"></script>

    
    <script src="../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
